//
// Created by 王乐 on 2022/2/5.
//

#ifndef LESTE_LECAMERAFLYBEHAVIOUR_H
#define LESTE_LECAMERAFLYBEHAVIOUR_H

#include "LeCameraBaseBehaviour.h"

enum Camera_Movement {
    CM_FORWARD,
    CM_BACKWARD,
    CM_LEFT,
    CM_RIGHT
};

class LeCameraFlyBehaviour : public LeCameraBaseBehaviour
{
public:
    LeCameraFlyBehaviour();
    virtual ~LeCameraFlyBehaviour();

public:
    void Awake() override;
    void Start() override;
    void Update() override;

public:
    glm::mat4 getViewMatrix() override;
    glm::mat4 getProjectionMatrix() override;

private:
    // processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems)
    void processKeyboard(Camera_Movement direction);

    // processes input received from a mouse input system. Expects the offset value in both the x and y direction.
    void processMouseMovement(float xoffset, float yoffset, bool constrainPitch);

    // processes input received from a mouse scroll-wheel event. Only requires input on the vertical wheel-axis
    void processMouseScroll(float yoffset);

    // calculates the front vector from the Camera's (updated) Euler Angles
    void updateCameraVectors();

public:
    float yaw;
    float pitch;
public:
    float moveSpeed;
    float mouseSensitivity;
    float zoom;

    glm::vec3 Front;
    glm::vec3 Up;
    glm::vec3 Right;
    glm::vec3 WorldUp;

    bool firstMouse;
    float dLastX;
    float dLastY;

    bool bIsPerspectiveView;
};


#endif //LESTE_LECAMERAFLYBEHAVIOUR_H
